import axios from '@/api/interceptor'
import {
    ConservationCreateReq, ConservationDetail,
    ConservationPagination,
    ConservationRes,
    ConservationUpdateReq, GetAllConservationParam, GetConservationListParam
} from "@/types/conservationType";


// 获取所有会话
export function queryConservationAll(params: GetAllConservationParam): Promise<ConservationRes[]> {
    return axios.get('api/v1/sapper/conservation/all',
        params
    );
}

// 获取会话详情
export function queryConservationDetail(uuid: string): Promise<ConservationDetail> {
    return axios.get(`api/v1/sapper/conservation/${uuid}`);
}

// 获取会话列表（分页）
export function queryConservationList(params?: GetConservationListParam): Promise<ConservationPagination> {
    return axios.get('api/v1/sapper/conservation', {
        params
    });
}

// 创建会话
export function createConservationAPI(data: ConservationCreateReq): Promise<ConservationRes> {
  return axios.post(`api/v1/sapper/conservation`, data);
}

// 更新会话
export function updateConservationAPI(uuid: string, data: ConservationUpdateReq) {
    return axios.put(`api/v1/sapper/conservation/${uuid}`, data);
}

// 删除会话
export function deleteConservationAPI(pk: string) {
    return axios.delete(`api/v1/sapper/conservation/${pk}`);
}
